package com.shoppingmall.widget;

import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;

import com.shoppingmall.R;
import com.shoppingmall.interfaces.CallBackId;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

public class RegisterDialog extends DialogFragment implements CallBackId {
    @BindView(R.id.image_sucess)
    ImageView imageSucess;
    @BindView(R.id.bnt_sure)
    TextView bntSure;
    private Unbinder unbinder;
    private CallBackId callBackId;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.dialog_register, container, false);
        getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
        getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        unbinder = ButterKnife.bind(this, view);
        return view;
    }

    @Override
    public void getid(String id, String name) {

    }

    public void setSelectAddresFinish(CallBackId callBackId) {
        this.callBackId = callBackId;
    }


    @Override
    public void onStart() {
        super.onStart();
        DisplayMetrics dm = new DisplayMetrics();
        getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
        //getDialog().getWindow().setLayout(dm.widthPixels, dm.heightPixels - StatusUtil.getStatusBarHeight(getActivity()));
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }


    @OnClick(R.id.bnt_sure)
    public void onViewClicked() {
        dismiss();
        callBackId.getid("","");

    }
}
